package com.sinsoft.monitorDemo.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sinosoft.framework.core.common.utils.ajax.ResponseData;
import com.sinsoft.monitorDemo.dao.NginxInfoDao;
import com.sinsoft.monitorDemo.entity.NginxInfo;

@Controller
@RequestMapping("/nginxInfo")
public class NginxInfoController {
	
	@RequestMapping(value = "/getNginxinfoList", method = RequestMethod.POST)
	@ResponseBody
	public ResponseData getNginxinfoList(HttpServletRequest request){
		NginxInfoDao dao = new NginxInfoDao();
		String ip = request.getParameter("ip");
		List<NginxInfo> nginxInfo = dao.getNginxInfoList(ip);
		ResponseData responseData = new ResponseData(true, nginxInfo);
		return responseData;	
	}
	
	
	@RequestMapping(value = "/getNewNginxinfo", method = RequestMethod.POST)
	@ResponseBody
	public ResponseData getNewNginxinfo(HttpServletRequest request){
		NginxInfoDao dao = new NginxInfoDao();
		String ip = request.getParameter("ip");
		NginxInfo newNginxInfo = dao.getNewNginxInfo(ip);
		ResponseData responseData = new ResponseData(true, newNginxInfo);
		return responseData;	
	}
}
